package com.zhoulu.domain.util;

import lombok.Getter;
import lombok.Setter;


@Setter
@Getter
public class LayuiResult {

    private int code;
    private String msg;
    private long count;
    private Object data;

    private LayuiResult(int code, String msg){
        this.code = code;
        this.msg = msg;
    }

    private LayuiResult(int code, String msg, Object data){
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    private LayuiResult(int code, String msg, long count, Object data){
        this.code = code;
        this.msg = msg;
        this.count = count;
        this.data = data;
    }

    public static LayuiResult success(String msg){
        return new LayuiResult(0, msg);
    }

    public static LayuiResult success(String msg, Object data){
        return new LayuiResult(0, msg, data);
    }

    public static LayuiResult success(String msg, long count, Object data){
        return new LayuiResult(0, msg, count, data);
    }

    public static LayuiResult error(String msg){
        return new LayuiResult(-1, msg);
    }
}
